<?php
include('../../include/functions.inc.php');
$user = unserialize($_SESSION['user']);
$in = unserialize($_SESSION["invoice"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Asignacion de Estudiantes</title>
        <link href="../../bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
        <link href="../../css/ContentStyle.css" rel="stylesheet" type="text/css" />
        <link href="../../css/tableorderer.css" rel="stylesheet" type="text/css" />
        <link href="../../js/dialog/dialog.2.0.css" rel="stylesheet" type="text/css" />
        <script src="../../js/prototype.js" type="text/javascript"></script>
        <script src="../../js/jsvalidate.js" type="text/javascript"></script>
        <script src="../../js/dialog/dialog.2.0.js" type="text/javascript"></script>
        <script src="../../js/include.js" type="text/javascript"></script>
        <script type="text/javascript">
            var rsv;
            config=function(){ 
                rsv=new RSV({   formID: $(document.FACTURA),
                    errorFieldClass: "errorField",
                    rules: ["required,NIT,No. NIT es requerido!",
                        "required,NAME,Nombre de factura es requerido!",
                        "required,CONCEPTO,Concepto de factura es requerido!"],
                    displayType : "display-html",
                    errorHTMLItemBullet : "&#8212;",
                    onCompleteHandler:function(){
                        waitMsg("Guardando...");
                        $(document.FACTURA).request({onComplete:function(r){
                                closeWait();
                                alert(r.responseText);
                                var msg='Se genero la factura: '+r.responseJSON.FACTURA;
                                msg=msg+"<hr>"+"Desea realizar otro Cobro?";
                                Dialogs.confirm(
                                msg,
                                function(){
                                    $(document.FACTURA).action="index.php";
                                    $(document.FACTURA).submit();
                                    Dialogs.close();
                                },
                                function(){
                                    $(document.FACTURA).action="index.php";
                                    $(document.FACTURA).submit();
                                    Dialogs.close();
                                }
                            );
                            }});
                    }
                });
            }
            addOnLoad(config);
        </script>
    </head>

    <body>
        <div id="tabs">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a>DATOS DE FACTURACIÓN</a>
                </li>
            </ul>
        </div>
        <div id="tabs-cont">
            <div id="rsvErrors"></div>
            <form id="FACTURA" name="FACTURA" method="GET" action="data.php">
                <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <th scope="col" width="50%"></th>
                        <th scope="col" width="50%">
                            <input type="button" name="cmdOk" id="cmdOk" class="btn btn-info" value="Continuar" onclick="rsv.validate();" />
                        </th>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>FACTURA</td>
                                    <td><?php echo $in["factura"]["SERIE"] ?>-?</td>
                                </tr>
                                <tr>
                                    <td width="25%">NIT</td>
                                    <td width="75%">            <input name="NIT" type="text" id="NIT" value="<?php echo $in["nit"]; ?>" />
                                        <input name="operation" type="hidden" id="operation" value="invoice" /></td>
                                </tr>
                                <tr>
                                    <td>NOMBRE </td>
                                    <td><input name="NAME" type="text" id="NAME" value="<?php echo $in["nombre"]; ?>" /></td>
                                </tr>

                                <tr>
                                    <td>DIRECCION</td>
                                    <td><input name="ADDRESS" type="text" id="ADDRESS" size="50" value="<?php echo $in["dir"]; ?>" /></td>
                                </tr>
                                <tr>
                                    <td>MONTO A COBRAR</td>
                                    <td><input name="TOTAL"  type="text" id="TOTAL" readonly="readonly" value="<?php echo $in["total"]; ?>"  /></td>
                                </tr>
                                <tr>
                                    <td>IVA </td>
                                    <td><input name="IVA" type="text" id="IVA"  readonly="readonly" value="<?php echo $in["iva"]; ?>" /></td>
                                </tr>
                                <tr>
                                    <td>CONCEPTO FACTURA</td>
                                    <td><textarea name="CONCEPTO" id="CONCEPTO" cols="45" rows="5">
                                        </textarea></td>
                                </tr>
                            </table></td>
                    </tr>
                    <tr>
                        <td colspan="2">&nbsp;</td>
                    </tr>
                </table>
            </form>
        </div> 
    </body>
</html>
